package com.clms.rents.controller;

import com.clms.common.R;
import com.clms.rents.pojo.entity.TbBrand;
import com.clms.rents.pojo.vo.CarBrandVo;
import com.clms.rents.service.CarBrandService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-third
 * @description: 车的品牌
 * @author: 杨浩
 * @create: 2021-07-22 12:17
 **/

@RestController
@RequestMapping("rents/brand")
public class CarBrandController {

    @Resource
    private CarBrandService carBrandService;

    @GetMapping("selectall")
    public R selectall(){
        return carBrandService.selectall();
    }//


    @PostMapping("pageSelect/{currentPage}/{pageSize}")
    public R pageSelect(@PathVariable Integer currentPage,
                        @PathVariable Integer pageSize,
                        @RequestBody CarBrandVo carBrandVo){
        return carBrandService.pageSelect(currentPage,pageSize,carBrandVo);
    }
    @PostMapping("insert")
    public R insert(@RequestBody TbBrand tbCarType){
        return carBrandService.insert(tbCarType);
    }

    @GetMapping("selectById/{id}")
    public R selectByid(@PathVariable Integer id){
        return carBrandService.selectById(id);
    }

    @PutMapping("update")
    public R update(@RequestBody TbBrand tbCarType){
        return carBrandService.update(tbCarType);
    }
    @DeleteMapping
    public R delete(@RequestParam Integer id){
        return carBrandService.delete(id);
    }

    @PostMapping("selectByName")
    public R selectByName(@RequestBody CarBrandVo carBrandVo){
        return carBrandService.selectByName(carBrandVo);
    }

}
